// zh_dianc/pages/Liar/Liar.js
var base = require('../../utils/lang.js');
const _ = base._

var a = getApp();
Page({

	/**
	 * 页面的初始数据
	 */
	data: {
		_t: base._t(),
		imgUrls: [
			'http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg',
			'http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg',
			'http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg'
		],
	},

	/**
	 * 生命周期函数--监听页面加载
	 */
	onLoad: function(options) {
		const isWei = base.isWeiFn()
		this.setData({
			isWei
		})
		var that = this;
		a.setNavigationBarColor(this);
		a.pageOnLoad(this);
		// 系统设置
		a.util.request({
			'url': 'entry/wxapp/system',
			'cachetime': '0',
			success: function(res) {
				console.log(res)
				var xtxx = res.data;
				that.setData({
					xtxx: xtxx,
				})
				// wx.setNavigationBarTitle({
				//   title: res.data.url_name,
				// })
			},
		})
	},
	maketel: function(t) {
		var a = this.data.xtxx.tel;
		wx.makePhoneCall({
			phoneNumber: a,
		})
	},
	location: function() {
		var jwd = this.data.xtxx.gs_zb.split(','),
			t = this.data.xtxx;
		console.log(jwd)
		wx.openLocation({
			latitude: parseFloat(jwd[0]),
			longitude: parseFloat(jwd[1]),
			address: t.gs_add,
			name: _('位置')
		})
	},
	/**
	 * 生命周期函数--监听页面初次渲染完成
	 */
	onReady: function() {

	},

	/**
	 * 生命周期函数--监听页面显示
	 */
	onShow: function() {
		this.setData({
			_t: base._t()
		})
	},

	/**
	 * 生命周期函数--监听页面隐藏
	 */
	onHide: function() {

	},

	/**
	 * 生命周期函数--监听页面卸载
	 */
	onUnload: function() {

	},

	/**
	 * 页面相关事件处理函数--监听用户下拉动作
	 */
	onPullDownRefresh: function() {
		this.onLoad();
		wx.stopPullDownRefresh();
	},

	/**
	 * 页面上拉触底事件的处理函数
	 */
	onReachBottom: function() {

	},

	/**
	 * 用户点击右上角分享
	 */
	onShareAppMessage: function() {

	}
})
